package com.dxy.lc.service.impl;

import cn.hutool.core.lang.Assert;
import com.dxy.lc.model.entity.Todo;
import com.dxy.lc.mapper.TodoMapper;
import com.dxy.lc.service.TodoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
* <p>
*  服务实现类
* </p>
*
* @author dxy
* @since 2024-12-06
*/
@Slf4j
@Service
public class TodoServiceImpl extends ServiceImpl<TodoMapper, Todo> implements TodoService {


    @Override
    public void edit(Todo params) {
        Assert.notBlank(params.getId());
        Assert.notBlank(params.getType());
        Assert.notNull(params.getFinished());
        saveOrUpdate(params);
    }

    @Override
    public List<Todo> getByType(String type) {
        Assert.notBlank(type);
        return list(new LambdaQueryWrapper<Todo>().eq(Todo::getType, type));
    }
}
